<template>
  <div>
    <LikeDog :dogArr="dogArr" :likeArr="addArr" @add="add" />
  </div>
</template>

<script>
import like from "./components/like.vue";
export default {
  components: {
    LikeDog: like,
  },
  data() {
    return {
      addArr: [],
      dogArr: [
        {
          id: "001",
          src: "https://ns-strategy.cdn.bcebos.com/ns-strategy/upload/fc_big_pic/part-00578-1996.jpg",
          p: "边境柯利犬",
        },
        {
          id: "002",
          src: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F0f74ceb1-d201-4a1f-8da7-72c56ea16749%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1681916283&t=10a50bd12798498bdbdc0a747c8e132c",
          p: "金毛",
        },
        {
          id: "003",
          src: "https://img2.baidu.com/it/u=73055802,2758143707&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500",
          p: "黄斑狗",
        },
        {
          id: "004",
          src: "https://gss0.baidu.com/94o3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/eac4b74543a98226fff1d7ba8c82b9014a90eb7f.jpg",
          p: "日本柴犬",
        },
        {
          id: "005",
          src: "https://www.hoyoh.com/uploads/allimg/20191219/yxt3u5eatxy22744.jpg",
          p: "法斗",
        },
        {
          id: "006",
          src: "https://img.mp.itc.cn/upload/20161030/0bf4745fadf046b3a68ece0763fc3010_th.jpeg",
          p: "柯基",
        },
      ],
    };
  },
  methods: {
    add(id) {
      this.addArr.push(this.dogArr.find((item) => item.id === id).p);
    },
  },
};
</script>

<style>
</style>